Skip to content

BDMS 221 & 227: function to retrieve polymorphic table record#238

Merged
jirhiker merged 3 commits into
stagingfrom
jab-bdd-testing-setup-and-helpers
Nov 11, 2025
Merged

BDMS 221 & 227: function to retrieve polymorphic table record#238
jirhiker merged 3 commits into
stagingfrom
jab-bdd-testing-setup-and-helpers

Conversation

@jacob-a-brown

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • Records from the parameter and status_history tables need to be easily retrieved for schemas and tests

How

Implementation summary - the following was changed / added / removed:

  • A function to retrieve a record was put into services/util.py

Notes

Any special considerations, workarounds, or follow-up work to note?

  • This only retrieves one function in a sorted list by start_date. I don't think that we need one to retrieve all records since that is easily done via the attribute from the mixins.

@codecov-commenter

codecov-commenter commented Nov 10, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tests/__init__.py 11.11% 8 Missing ⚠️
Files with missing lines Coverage Δ
tests/__init__.py 83.67% <11.11%> (-16.33%) ⬇️

... and 5 files with indirect coverage changes

@jirhiker jirhiker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this being used

@jacob-a-brown

jacob-a-brown commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

I'll use it in tests. I initially thought I'd use it throughout, but it may not actually be needed (I'm still developing responses, so TBD). From your comment on the well additional info PR I figured I'd put it in services/util.py, but if it's just used in tests should it go in tests/__init__.py?

@jacob-a-brown

jacob-a-brown commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

I need to add a check in there, too, that end_date is null

@jacob-a-brown

Copy link
Copy Markdown
Contributor Author

I updated this to make sure end_date is not null, but since status_history is eagerly loaded for each thing object I don't need to use polymorphic_relationship in the API. So I've moved it to tests/__init__.py for use in tests only.

@jirhiker jirhiker self-requested a review November 11, 2025 02:09
@jirhiker jirhiker merged commit cc1ec90 into staging Nov 11, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants